﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class SumUtils
    {
        //计算两个整数相加、两个小数相加、 两个字符串相加、以及从 1 到指定整数的和的方法。
        private int index01;
        private int index02;
        private double index03;
        private double index04;
        private string index05;
        private string index06;
        private int index07;

        /// <summary>
        /// 两个整数相加
        /// </summary>
        /// <param name="index01">第一个整数</param>
        /// <param name="index02">第二个整数</param>
        /// <returns>两个整数相加的值</returns>
        public int Get(int index01,int index02)
        {
            return index01 + index02;
        }

        /// <summary>
        /// 两个小数相加
        /// </summary>
        /// <param name="index03">第一个小数</param>
        /// <param name="index04">第二个小数</param>
        /// <returns>两个小数相加的值</returns>
        public double Get(double index03,double index04)
        {
            return index03 + index04;
        }

        /// <summary>
        /// 两个字符串相加
        /// </summary>
        /// <param name="index05">第一个字符串</param>
        /// <param name="index06">第二个字符串</param>
        /// <returns>两个字符串相加的值</returns>
        public string Get(string index05,string index06)
        {
            return index05 + index06;
        }

        /// <summary>
        /// 从 1 到指定整数的和
        /// </summary>
        /// <param name="index07">指定的整数</param>
        /// <returns>从 1 到指定整数的和</returns>
        public int Get(int index07)
        {
            int sum = 0;
            for (int i = 1; i <= index07; i++)
            {
                sum = i + sum;
            }
            return sum;
        }
    }
}
